.TH "ggiOpen" 3 "2007-12-17" "libggi-current" GGI
.SH NAME
\fBggiOpen\fR, \fBggiClose\fR : Open and close a visual
.SH SYNOPSIS
.nb
.nf
#include <ggi/ggi.h>

int ggiOpen(ggi_visual_t vis, const char *display, ...);

int ggiClose(ggi_visual_t vis);
.fi

.SH DESCRIPTION
\fBggiOpen\fR opens a visual.  \fIvis\fR is a stem created by \f(CWggNewStem(3)\fR.
The visual is specified as a display string, followed by \fBNULL\fR. 
If only \fBNULL\fR is specified, the default display target is opened,
which means first examining \fBGGI_DISPLAY\fR, then invoking
display-auto.  The other arguments are for internal purposes only,
such as \fIargptr\fR, used to pass driver-specific, non-textual information to
the driver.

\fBggiClose\fR releases and destroys an open visual.  This will close X
windows, return consoles to text-mode, etc.
.SH RETURN VALUE
\fBggiOpen\fR returns \fB0\fR for OK, otherwise a \f(CWgg-error(3)\fR code.

\fBggiClose\fR returns \fB0\fR for OK, otherwise a \f(CWgg-error(3)\fR code.
.SH EXAMPLES
Open and closing default visual:

.nb
.nf
int          err;
ggi_visual_t vis;

vis = ggNewStem(libggi, NULL);
if (vis == NULL) {
      ggPanic("Couldn't create stem!\en");
}

err = ggiOpen(vis, NULL);
if (err != GGI_OK) {
      ggPanic("Couldn't open default visual!\en");
}

/* do stuff */

err = ggiClose(vis);
if (err != GGI_OK) {
      ggPanic("Couldn't close default visual!\en");
}

ggDelStem(vis);
ggExit();
.fi

Open and closing a memory visual:

.nb
.nf
int          err;
ggi_visual_t memvis;

memvis = ggNewStem(libggi, NULL);
if (memvis == NULL) {
      ggPanic("Could not create stem!\en");
}

err = ggiOpen(memvis, "display-memory", NULL);
if (err != GGI_OK) {
      return -1;
}

/* do stuff */

err = ggiClose(memvis);
if (err != GGI_OK) {
      return -1;
}

ggDelStem(memvis);
ggExit();
.fi

.SH SEE ALSO
\f(CWggNewStem(3)\fR, \f(CWggiInit(3)\fR, \f(CWlibggi(7)\fR
